package com.example.demo2;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.example.demo2.mapper.SeckillGoodsMapper;
import com.example.demo2.model.SeckillGoods;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class testVersion {
    @Autowired
    private SeckillGoodsMapper seckillGoodsMapper;

    @Test
    void testVersion(){
        UpdateWrapper<SeckillGoods> wrapper = new UpdateWrapper<>();
        wrapper.setSql("count = count - 1");
        SeckillGoods seckillGoods = SeckillGoods.builder().version(1).build();
        seckillGoodsMapper.update(seckillGoods, wrapper);
        System.out.println("回填版本号："+ seckillGoods.getVersion());
    }

}
